﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// getNewsDetail 的摘要说明
/// </summary>
public class getNewsDetail
{
    public string sTitle;
    public string sWriter;
    public string sFrom;
    public string sVisit;
    public string sContent;
    public string sModifyDate;
    public string sTypeName;
    public getNewsDetail(int iNewsID)
	{
        SqlDataSource ds = new SqlDataSource();

        ds.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["Jxzy_Database"].ToString();
        ds.SelectCommand = "SELECT  News_Title AS title, News_TypeName typename,News_Visit as visit,News_ModifyDate modifydate,News_Content content,News_Writer as writer,News_From  FROM zyk_News ";
        ds.SelectCommand += " WHERE News_ID=@newsid";
        ds.SelectParameters.Add("newsid", DbType.Int32, iNewsID.ToString());

        DataView dv = (DataView)ds.Select(DataSourceSelectArguments.Empty);

        if (dv.Count > 0)
        {
            sTitle = dv[0]["title"].ToString();
            sWriter = dv[0]["writer"].ToString();
            sFrom = dv[0]["News_From"].ToString();
            sVisit = dv[0]["visit"].ToString();
            sContent = dv[0]["content"].ToString();
            sTypeName = dv[0]["typename"].ToString();
            sModifyDate = dv[0]["modifydate"].ToString();
            DateTime a = Convert.ToDateTime(sModifyDate);
            sModifyDate = a.ToString("yyyy年MM月dd日");
        }

	}
}
